import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeIndex from '../views/HomeIndex.vue';
import ProList from '../views/ProList.vue';
import ProDetail from '../views/ProDetail.vue';
import MyLogin from '../views/MyLogin.vue';
import MyNotice from '../views/MyNotice.vue';
import MyAccount from '../views/MyAccount.vue';
import NotFound from '../views/NotFound.vue';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'home',
    component: HomeIndex
  },
  {
    path: '/list',
    name: 'list',
    component: ProList
  },
  {
    path: '/detail/:id',
    name: 'detail',
    component: ProDetail
  },
  {
    path: '/login',
    name: 'login',
    component: MyLogin
  },
  {
    path: '/notice',
    name: 'notice',
    component: MyNotice
  },
  {
    path: '/account',
    name: 'account',
    component: MyAccount
  },
  {
    path:"/:pathMatch(.*)*",
    name:'notfound',
    component:NotFound
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
